<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<head>
<title> 管理后台 -开心吧   版主</title>
<jsp:include page="/public/header-meta.jsp"></jsp:include>
<jsp:include page="/public/header.jsp"></jsp:include>
</head>
<body id="startbbs">
<div id="wrap">
<div class="container" id="page-main" >
<div class="row">
<jsp:include page="leftbar.jsp"></jsp:include>
<div class='col-xs-12 col-sm-6 col-md-9' >

<div class='box'>
<div class='cell'>
<a href="welcome" class="startbbs1">开心吧</a> <span class="chevron">&nbsp;›&nbsp;
</span> <a href="admin!sectionList">管理后台</a> <span class="chevron">&nbsp;›&nbsp;
</span> ${sname}
</div>
<div class='cell'>
<table class='topics table' >
<thead>
<tr>
<td align='left' class='auto'><input id="checkall" type="checkbox" ></td>
<td  align="center" class='w50'>ID</td>
<td align='center' class='auto'>用户组名</td>
<td align='center' class='auto'>用户组人数</td>
<td align="center" class='auto'>描述</td>
<td align="center" class='auto'>权限组</td>
<td align='center'>操作</td>
</tr>
</thead>
<tbody>
<s:iterator value="group">
<tr class='center' >
	<td class='auto' align='left'><input name="" value="${groupid}" type="checkbox" id="check"></td>
	<td class='auto'>${groupid }</td>
	<td class='auto'>${groupName}</td>
	<td align='center' class='auto'>${usernum }</td>
	<td align='center' class='auto'>${description }</td>
	<td align='center' class='auto'>
	<s:iterator value="privilege">
	${name }
	</s:iterator>
	<%-- <c:forEach items="${privilege }" var="p">
	${p.name }
	</c:forEach> --%>
	</td>
	<td class='w100'>
		<a href="javascript:void(0)"  class="btn btn-primary btn-sm" 
		onclick="doedit('${groupName}','${description }','${groupid}','${usernum}')">编辑</a>
		<a href="del?topic.TID=${tid }&user.uid=${bbsUser.uid}" class="btn btn-sm btn-danger" onclick=" return confirm('确定删除？')" rel="nofollow">删除</a>
	</td>
</tr>
</s:iterator>
</tbody>
</table>

<div class='form-actions'>
<input class="btn btn-primary btn-danger" name="batch_del" type="submit" value="批量删除" />
<a class="btn btn-primary" data-toggle="modal" href="#modal-id">添加</a>
</div>
</div>
<div align='center' class='inner'>分页 未完成<div>
<ul class='pagination'></ul>
</div></div></div></div></div></div></div>



<jsp:include page="/public/footer.jsp"></jsp:include>
<div class="modal fade" id="modal-id">
		<div class="modal-dialog">
		<form accept-charset="UTF-8" action="group!addGroup" method="post" class="form-horizontal uc-form" id="add_group">
		<s:token/>
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h3 class="modal-title"> 添加用户组</h3>
				</div>
				<div class="modal-body">
				<!-- form start -->
				<section class="box-input-txt">
				<ul>
					<li class="form-group">
					<input class="form-control" type="text" name="description" placeholder="请输入用户组描述" required>
					</li>
					<li class="form-group">
					<input class="form-control" type="text" name="groupName" placeholder="请输入用户组名称" required >
					</li>
					<li class="form-group">
					<select class="form-control"  name="pid" id="t">
						<s:iterator var="privi" value="privi">
						<option value="${privi.pid }">${privi.name }</option >
						</s:iterator>
					</select>
					</li>
				</ul>
				<div>
				<button type="submit" class="btn btn-primary btn-block">保存</button>
				</div>
				<div class="tips-error bg-danger">错误提示</div>
				</section>
				
				<!-- form end -->
				</div>
			</div><!-- /.modal-content -->
			</form>
		</div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
	
	<div class="modal fade" id="edit_group">
		<div class="modal-dialog modal-sm">
		<form accept-charset="UTF-8" action="group!updategroup" method="post" class="form-horizontal uc-form" id="edit_">
		<s:token/>
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h3 class="modal-title"> 编辑用户组</h3>
				</div>
				<div class="modal-body">
				<!-- form start -->
				<section class="box-input-txt">
				<ul>
				<input type="hidden" name="usernum" id="usernum">
				<li class="form-group">
				<input class="form-control" type="text" name="groupName" id="groupName" placeholder="请输入用户组名称" required>
				</li>
				<li class="form-group">
				<input class="form-control" type="text" name="description" id="description" placeholder="请输入用户组描述" required >
				</li>
				<li class="form-group">
					<select class="form-control"  name="pid" id="pid">
						<s:iterator var="privi" value="privi2">
						<option value="${privi.pid }">${privi.name }</option >
						</s:iterator>
					</select>
				</li>
				</ul>
				<div>
				<button type="submit" class="btn btn-primary btn-block">保存</button>
				</div>
				<div class="tips-error bg-danger">错误提示</div>
				</section>
				
				<!-- form end -->
				</div>
			</div><!-- /.modal-content -->
			</form>
		</div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
<script type="text/javascript">
	function doedit(data1,data2,id,num){
		$("#groupName").attr("value",data1);
		$("#description").attr("value",data2);
		$("#groupid").attr("value",id);
		$("#usernum").attr("value",num);
		$('#edit_group').modal('show').on('shown',function(){
		});
	}
</script>
<script type="text/javascript">
	$(document).ready(function(){
  		$("#checkall").bind('click',function(){
  		$("input:checkbox").prop("checked",$(this).prop("checked"));//全选
  	});
});
</script>
</body></html>

